<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>CXW_CSVManage: D:/MyExample/CPlusPlus/SimpleLearn/24.CSVManTest/Test.cpp源文件</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">CXW_CSVManage
   &#160;<span id="projectnumber">V1.0</span>
   </div>
   <div id="projectbrief">CXW_CSVManage</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- 制作者 Doxygen 1.8.0 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>首页</span></a></li>
      <li><a href="pages.html"><span>相关页面</span></a></li>
      <li><a href="namespaces.html"><span>命名空间</span></a></li>
      <li><a href="annotated.html"><span>类</span></a></li>
      <li class="current"><a href="files.html"><span>文件</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="搜索" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>文件列表</span></a></li>
      <li><a href="globals.html"><span>文件成员</span></a></li>
    </ul>
  </div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>全部</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>类</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>命名空间</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>文件</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>函数</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>变量</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>类型定义</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>枚举</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>枚举值</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">D:/MyExample/CPlusPlus/SimpleLearn/24.CSVManTest/Test.cpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_test_8cpp.html">浏览该文件的文档。</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 ﻿
<a name="l00012"></a>00012 <span class="preprocessor">#include &lt;iostream&gt;</span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &lt;fstream&gt;</span>
<a name="l00014"></a>00014 <span class="preprocessor">#include &quot;<a class="code" href="_c_s_v_manage_8h.html" title="CSV文件管理类 头文件">CSVManage.h</a>&quot;</span>
<a name="l00015"></a>00015 
<a name="l00016"></a>00016 <span class="keyword">using namespace </span>std;
<a name="l00017"></a>00017 
<a name="l00018"></a>00018 <span class="keywordtype">void</span> <a class="code" href="_test_8cpp.html#a969866bdcda3d87c56b34f9c1f00db2e">newFileTest</a>(<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html" title="CSV文件管理类.">CXW::CSVManage</a>&amp; csvMan);
<a name="l00019"></a>00019 <span class="keywordtype">void</span> <a class="code" href="_test_8cpp.html#ae24ba3b468c868529c3fb38d5fece4dd">loadFileTest</a>(<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html" title="CSV文件管理类.">CXW::CSVManage</a>&amp; csvMan);
<a name="l00020"></a>00020 <span class="keywordtype">void</span> <a class="code" href="_test_8cpp.html#a1ed4c1412464f9a144cd0995de6f9922">getRowFromStreamTest</a>(<span class="keywordtype">void</span>);
<a name="l00021"></a>00021 <span class="keywordtype">void</span> <a class="code" href="_test_8cpp.html#a55cfed92a64717004c70553793d3daf8">addRowToStreamTest</a>(<span class="keywordtype">void</span>);
<a name="l00022"></a>00022 <span class="keywordtype">void</span> <a class="code" href="_test_8cpp.html#a02acc92b458923b3b6f5c062a7df9062">sortTest</a>(<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html" title="CSV文件管理类.">CXW::CSVManage</a>&amp; csvMan);
<a name="l00023"></a>00023 
<a name="l00024"></a>00024 
<a name="l00025"></a><a class="code" href="_test_8cpp.html#a840291bc02cba5474a4cb46a9b9566fe">00025</a> <span class="keywordtype">int</span> <a class="code" href="_test_8cpp.html#a840291bc02cba5474a4cb46a9b9566fe">main</a>(<span class="keywordtype">void</span>)
<a name="l00026"></a>00026 {
<a name="l00027"></a>00027         <a class="code" href="class_c_x_w_1_1_c_s_v_manage.html" title="CSV文件管理类.">CXW::CSVManage</a> csvMan;
<a name="l00028"></a>00028 
<a name="l00029"></a>00029         <a class="code" href="_test_8cpp.html#a969866bdcda3d87c56b34f9c1f00db2e">newFileTest</a>(csvMan);
<a name="l00030"></a>00030 
<a name="l00031"></a>00031         <span class="comment">//loadFileTest(csvMan);</span>
<a name="l00032"></a>00032 
<a name="l00033"></a>00033         <span class="comment">//getRowFromStreamTest();</span>
<a name="l00034"></a>00034         <span class="comment">//addRowToStreamTest ();</span>
<a name="l00035"></a>00035 
<a name="l00036"></a>00036         <span class="comment">//sortTest(csvMan);</span>
<a name="l00037"></a>00037 
<a name="l00038"></a>00038         <span class="keywordflow">return</span> 0;
<a name="l00039"></a>00039 };
<a name="l00040"></a>00040 
<a name="l00041"></a>00041 
<a name="l00042"></a>00042 
<a name="l00043"></a><a class="code" href="_test_8cpp.html#a969866bdcda3d87c56b34f9c1f00db2e">00043</a> <span class="keywordtype">void</span> <a class="code" href="_test_8cpp.html#a969866bdcda3d87c56b34f9c1f00db2e">newFileTest</a>(<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html" title="CSV文件管理类.">CXW::CSVManage</a>&amp; csvMan)
<a name="l00044"></a>00044 {
<a name="l00045"></a>00045         <a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a837f66875528c761b13a2083c8a91ddd" title="标题行">CXW::CSVManage::Title</a> title;
<a name="l00046"></a>00046         title.push_back (<span class="stringliteral">&quot;编号&quot;</span>);
<a name="l00047"></a>00047         title.push_back (<span class="stringliteral">&quot;测点名称&quot;</span>);
<a name="l00048"></a>00048         title.push_back (<span class="stringliteral">&quot;时间戳&quot;</span>);
<a name="l00049"></a>00049         title.push_back (<span class="stringliteral">&quot;数值&quot;</span>);
<a name="l00050"></a>00050         title.push_back (<span class="stringliteral">&quot;质量码&quot;</span>);
<a name="l00051"></a>00051 
<a name="l00052"></a>00052         csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#aad6e4592958f6bf7647c594b3575b690" title="新建文件">newFile</a> (<span class="stringliteral">&quot;csvCreate.csv&quot;</span>,title);
<a name="l00053"></a>00053 
<a name="l00054"></a>00054         <a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a9f595345965918c5ded59d644137d585" title="一行数据">CXW::CSVManage::Row</a> row;
<a name="l00055"></a>00055         <span class="keywordtype">char</span> buf[32];
<a name="l00056"></a>00056 
<a name="l00057"></a>00057         <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0 ; i &lt; 1000000 ; i++)
<a name="l00058"></a>00058         {
<a name="l00059"></a>00059                 row.clear ();
<a name="l00060"></a>00060 
<a name="l00061"></a>00061                 row.push_back (_itoa (i,buf,10));               
<a name="l00062"></a>00062                 row.push_back (<span class="stringliteral">&quot;TagName001&quot;</span>);
<a name="l00063"></a>00063                 row.push_back (<span class="stringliteral">&quot;2012-7-12 9:23:00&quot;</span>);
<a name="l00064"></a>00064                 row.push_back (_itoa (rand(),buf,10));
<a name="l00065"></a>00065                 row.push_back (_itoa (i,buf,16));
<a name="l00066"></a>00066                 csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#ab77af6bec990064a5918c88fa8e304a1" title="增加一行内容">addRow</a> (row);
<a name="l00067"></a>00067         }
<a name="l00068"></a>00068 
<a name="l00069"></a>00069         csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a95e33de0c53b9bec25ff8beaa0acf19e" title="保存到默认文件">save</a>();
<a name="l00070"></a>00070 }
<a name="l00071"></a>00071 
<a name="l00072"></a><a class="code" href="_test_8cpp.html#ae24ba3b468c868529c3fb38d5fece4dd">00072</a> <span class="keywordtype">void</span> <a class="code" href="_test_8cpp.html#ae24ba3b468c868529c3fb38d5fece4dd">loadFileTest</a>(<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html" title="CSV文件管理类.">CXW::CSVManage</a>&amp; csvMan)
<a name="l00073"></a>00073 {
<a name="l00074"></a>00074         <span class="comment">//      首次测试验证</span>
<a name="l00075"></a>00075         csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a0f47f5c8ef415d8506b94ec9102a6032" title="载入文件">loadFile</a> (<span class="stringliteral">&quot;test.csv&quot;</span>,<span class="keyword">true</span>);
<a name="l00076"></a>00076 
<a name="l00077"></a>00077         <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0 ;i &lt; csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a719360364dd5871fd7163d8a9496351c" title="获取行个数">getRowSize</a> () ; i++)
<a name="l00078"></a>00078         {
<a name="l00079"></a>00079                 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0 ;j &lt; csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a7adc913721208915c97f8b5390fa5bf5" title="获取列个数">getColSize</a> () ; j++)
<a name="l00080"></a>00080                 {
<a name="l00081"></a>00081                         <span class="keywordtype">string</span> str = csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#af232eb2a4ced6b58566f134eada35f51" title="取某个单元格的内容">getXY</a> (i,j).c_str() ;
<a name="l00082"></a>00082 <span class="comment">//                      str += &quot;add&quot;;</span>
<a name="l00083"></a>00083 <span class="comment">//                      csvMan.modify (i,j,str.c_str());</span>
<a name="l00084"></a>00084                 }
<a name="l00085"></a>00085         }
<a name="l00086"></a>00086 
<a name="l00087"></a>00087         cout &lt;&lt; <span class="stringliteral">&quot;csvMan.loadFile (\&quot;test.csv\&quot;,true);   test&quot;</span> &lt;&lt; endl;
<a name="l00088"></a>00088         cout &lt;&lt; <span class="stringliteral">&quot;hastitle ? &quot;</span> &lt;&lt; csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a971aa39095876c6aa4aefcaeaa1b8f72" title="判断是否有标题行">hasTitle</a> () &lt;&lt; endl;
<a name="l00089"></a>00089         cout &lt;&lt; <span class="stringliteral">&quot;datasize:   row = &quot;</span> &lt;&lt; csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a719360364dd5871fd7163d8a9496351c" title="获取行个数">getRowSize</a> () &lt;&lt; 
<a name="l00090"></a>00090                 <span class="stringliteral">&quot;  col = &quot;</span> &lt;&lt; csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a7adc913721208915c97f8b5390fa5bf5" title="获取列个数">getColSize</a> () &lt;&lt; endl;
<a name="l00091"></a>00091 
<a name="l00092"></a>00092         csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a1d7ee4d08ac1eaf47f8446325ebaf844" title="保存到文件">saveToFile</a> (<span class="stringliteral">&quot;testsave.csv&quot;</span>);
<a name="l00093"></a>00093 
<a name="l00094"></a>00094         cout &lt;&lt; <span class="stringliteral">&quot;csvMan.saveToFile (\&quot;testsave.csv\&quot;);   test&quot;</span> &lt;&lt; endl;
<a name="l00095"></a>00095         cout &lt;&lt; <span class="stringliteral">&quot;--------------------------------------------&quot;</span> &lt;&lt; endl &lt;&lt; endl;
<a name="l00096"></a>00096 
<a name="l00097"></a>00097         <span class="comment">//      二次测试验证</span>
<a name="l00098"></a>00098 
<a name="l00099"></a>00099         <span class="comment">//csvMan.loadFile (&quot;test.csv&quot;);</span>
<a name="l00100"></a>00100 
<a name="l00101"></a>00101         <span class="comment">//for (int i = 0 ;i &lt; csvMan.getRowSize () ; i++)</span>
<a name="l00102"></a>00102         <span class="comment">//{</span>
<a name="l00103"></a>00103         <span class="comment">//      for (int j = 0 ;j &lt; csvMan.getColSize () ; j++)</span>
<a name="l00104"></a>00104         <span class="comment">//      {</span>
<a name="l00105"></a>00105         <span class="comment">//              string str = csvMan.getXY (i,j).c_str() ;</span>
<a name="l00106"></a>00106         <span class="comment">//              str += &quot;add&quot;;</span>
<a name="l00107"></a>00107         <span class="comment">//              csvMan.modify (i,j,str.c_str());</span>
<a name="l00108"></a>00108         <span class="comment">//      }</span>
<a name="l00109"></a>00109         <span class="comment">//}</span>
<a name="l00110"></a>00110 
<a name="l00111"></a>00111         <span class="comment">//cout &lt;&lt; &quot;csvMan.loadFile (\&quot;test.csv\&quot;);   test&quot; &lt;&lt; endl;</span>
<a name="l00112"></a>00112         <span class="comment">//cout &lt;&lt; &quot;hastitle ? &quot; &lt;&lt; csvMan.hasTitle () &lt;&lt; endl;</span>
<a name="l00113"></a>00113         <span class="comment">//cout &lt;&lt; &quot;datasize:   row = &quot; &lt;&lt; csvMan.getRowSize () &lt;&lt; </span>
<a name="l00114"></a>00114         <span class="comment">//      &quot;  col = &quot; &lt;&lt; csvMan.getColSize () &lt;&lt; endl;</span>
<a name="l00115"></a>00115 
<a name="l00116"></a>00116         <span class="comment">//csvMan.saveToFile (&quot;testsave.csv&quot;);</span>
<a name="l00117"></a>00117 
<a name="l00118"></a>00118         <span class="comment">//cout &lt;&lt; &quot;csvMan.saveToFile (\&quot;testsave.csv\&quot;);   test&quot; &lt;&lt; endl;</span>
<a name="l00119"></a>00119         <span class="comment">//cout &lt;&lt; &quot;--------------------------------------------&quot; &lt;&lt; endl &lt;&lt; endl;</span>
<a name="l00120"></a>00120 }
<a name="l00121"></a>00121 
<a name="l00122"></a>00122 <span class="comment">//静态方法测试</span>
<a name="l00123"></a><a class="code" href="_test_8cpp.html#a1ed4c1412464f9a144cd0995de6f9922">00123</a> <span class="keywordtype">void</span> <a class="code" href="_test_8cpp.html#a1ed4c1412464f9a144cd0995de6f9922">getRowFromStreamTest</a>()
<a name="l00124"></a>00124 {
<a name="l00125"></a>00125         <a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a9f595345965918c5ded59d644137d585" title="一行数据">CXW::CSVManage::Row</a> row;
<a name="l00126"></a>00126 
<a name="l00127"></a>00127         fstream inf;
<a name="l00128"></a>00128         inf.open (<span class="stringliteral">&quot;test.csv&quot;</span>);
<a name="l00129"></a>00129         <span class="keywordflow">if</span>(inf.fail())
<a name="l00130"></a>00130         {
<a name="l00131"></a>00131                 cout &lt;&lt; <span class="stringliteral">&quot;open file error! &quot;</span> &lt;&lt; endl;
<a name="l00132"></a>00132                 return ;
<a name="l00133"></a>00133         }
<a name="l00134"></a>00134 
<a name="l00135"></a>00135         row = <a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#ae78701a8c66c5dd99ae9247e31fed674" title="从文件流获取一行内容">CXW::CSVManage::getRowFromStream</a> (inf);
<a name="l00136"></a>00136         <span class="keywordflow">while</span> (0 != row.size ())
<a name="l00137"></a>00137         {
<a name="l00138"></a>00138                 cout &lt;&lt; <span class="stringliteral">&quot;getRowFromStream success ! &quot;</span> &lt;&lt; <span class="stringliteral">&quot; row size : &quot;</span> &lt;&lt; row.size ()  
<a name="l00139"></a>00139                         &lt;&lt; <span class="stringliteral">&quot;   row[0] = [&quot;</span> &lt;&lt; row[0] &lt;&lt; <span class="stringliteral">&quot;]&quot;</span>
<a name="l00140"></a>00140                         &lt;&lt; <span class="stringliteral">&quot;  row[&quot;</span> &lt;&lt; row.size ()-1 &lt;&lt; <span class="stringliteral">&quot;] = [&quot;</span> &lt;&lt; row[row.size ()-1] &lt;&lt; <span class="stringliteral">&quot;]&quot;</span> &lt;&lt; endl;
<a name="l00141"></a>00141 
<a name="l00142"></a>00142                 row = <a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#ae78701a8c66c5dd99ae9247e31fed674" title="从文件流获取一行内容">CXW::CSVManage::getRowFromStream</a> (inf);
<a name="l00143"></a>00143         }
<a name="l00144"></a>00144 }
<a name="l00145"></a>00145 
<a name="l00146"></a>00146 <span class="comment">//静态方法测试</span>
<a name="l00147"></a><a class="code" href="_test_8cpp.html#a55cfed92a64717004c70553793d3daf8">00147</a> <span class="keywordtype">void</span> <a class="code" href="_test_8cpp.html#a55cfed92a64717004c70553793d3daf8">addRowToStreamTest</a>()
<a name="l00148"></a>00148 {
<a name="l00149"></a>00149         fstream inf;
<a name="l00150"></a>00150         inf.open (<span class="stringliteral">&quot;addRowtoStreamTest.csv&quot;</span>,ios_base::app );
<a name="l00151"></a>00151 
<a name="l00152"></a>00152         <span class="comment">//如果文件不存在，则创建并添加标题行</span>
<a name="l00153"></a>00153         <span class="keywordflow">if</span>(inf.fail())
<a name="l00154"></a>00154         {
<a name="l00155"></a>00155                 cout &lt;&lt; <span class="stringliteral">&quot;file does not exist,create it! &quot;</span> &lt;&lt; endl;
<a name="l00156"></a>00156                 inf.open (<span class="stringliteral">&quot;addRowtoStreamTest.csv&quot;</span>,ios_base::out);
<a name="l00157"></a>00157                 <a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a837f66875528c761b13a2083c8a91ddd" title="标题行">CXW::CSVManage::Title</a> title;
<a name="l00158"></a>00158                 title.push_back (<span class="stringliteral">&quot;编号&quot;</span>);
<a name="l00159"></a>00159                 title.push_back (<span class="stringliteral">&quot;测点名称&quot;</span>);
<a name="l00160"></a>00160                 title.push_back (<span class="stringliteral">&quot;时间戳&quot;</span>);
<a name="l00161"></a>00161                 title.push_back (<span class="stringliteral">&quot;数值&quot;</span>);
<a name="l00162"></a>00162                 title.push_back (<span class="stringliteral">&quot;质量码&quot;</span>);
<a name="l00163"></a>00163 
<a name="l00164"></a>00164                 <a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a8fd191855060e517871018ae89e31232" title="向文件流写入一行内容">CXW::CSVManage::addRowToStream</a> (inf,title);
<a name="l00165"></a>00165         }
<a name="l00166"></a>00166         
<a name="l00167"></a>00167         <a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a9f595345965918c5ded59d644137d585" title="一行数据">CXW::CSVManage::Row</a> row;
<a name="l00168"></a>00168         <span class="keywordtype">char</span> buf[32];
<a name="l00169"></a>00169 
<a name="l00170"></a>00170         <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0 ; i &lt; 10000 ; i++)
<a name="l00171"></a>00171         {
<a name="l00172"></a>00172                 row.clear ();
<a name="l00173"></a>00173 
<a name="l00174"></a>00174                 row.push_back (_itoa (i,buf,10));
<a name="l00175"></a>00175                 row.push_back (<span class="stringliteral">&quot;TagName001&quot;</span>);
<a name="l00176"></a>00176                 row.push_back (<span class="stringliteral">&quot;2012-7-12 9:23:00&quot;</span>);
<a name="l00177"></a>00177                 row.push_back (_itoa (rand(),buf,10));
<a name="l00178"></a>00178                 row.push_back (_itoa (i,buf,16));
<a name="l00179"></a>00179 
<a name="l00180"></a>00180                 <a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a8fd191855060e517871018ae89e31232" title="向文件流写入一行内容">CXW::CSVManage::addRowToStream</a> (inf,row);
<a name="l00181"></a>00181         }
<a name="l00182"></a>00182         inf.close();
<a name="l00183"></a>00183 }
<a name="l00184"></a>00184 
<a name="l00185"></a><a class="code" href="_test_8cpp.html#a02acc92b458923b3b6f5c062a7df9062">00185</a> <span class="keywordtype">void</span> <a class="code" href="_test_8cpp.html#a02acc92b458923b3b6f5c062a7df9062">sortTest</a>(<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html" title="CSV文件管理类.">CXW::CSVManage</a>&amp; csvMan)
<a name="l00186"></a>00186 {
<a name="l00187"></a>00187         csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a79af6dab96c74ffde913957ea1bba7f5" title="对内容按任意列的排序">sort</a> (1,<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a8bd8eeeb7e83173a7588479446dee976a4c93b4e8af0299e5c99e95978f687c2d" title="字符串从 A 到 Z，判断大小写整型数据从小到大">CXW::CSVManage::STRING_A_TO_Z</a>);
<a name="l00188"></a>00188         csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a1d7ee4d08ac1eaf47f8446325ebaf844" title="保存到文件">saveToFile</a> (<span class="stringliteral">&quot;./test/test_STRING_A_TO_Z.csv&quot;</span>);
<a name="l00189"></a>00189 
<a name="l00190"></a>00190         csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a79af6dab96c74ffde913957ea1bba7f5" title="对内容按任意列的排序">sort</a> (1,<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a8bd8eeeb7e83173a7588479446dee976a77e4e65a073540b093aa5e2a90931be6" title="字符串从 Z 到 A，判断大小写整型数据从大到小">CXW::CSVManage::STRING_Z_TO_A</a>);
<a name="l00191"></a>00191         csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a1d7ee4d08ac1eaf47f8446325ebaf844" title="保存到文件">saveToFile</a> (<span class="stringliteral">&quot;./test/test_STRING_Z_TO_A.csv&quot;</span>);
<a name="l00192"></a>00192 
<a name="l00193"></a>00193         csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a79af6dab96c74ffde913957ea1bba7f5" title="对内容按任意列的排序">sort</a> (1,<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a8bd8eeeb7e83173a7588479446dee976ad9030ccd819284040418ddb814516655" title="字符串从 A 到 Z，忽略大小写单精度浮点型数据从小到大">CXW::CSVManage::STRING_Aa_TO_Zz</a>);
<a name="l00194"></a>00194         csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a1d7ee4d08ac1eaf47f8446325ebaf844" title="保存到文件">saveToFile</a> (<span class="stringliteral">&quot;./test/test_STRING_Aa_TO_Zz.csv&quot;</span>);
<a name="l00195"></a>00195 
<a name="l00196"></a>00196         csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a79af6dab96c74ffde913957ea1bba7f5" title="对内容按任意列的排序">sort</a> (1,<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a8bd8eeeb7e83173a7588479446dee976a4472b83a9490668a63b02d76e7d73cfe" title="字符串从 Z 到 A，忽略大小写单精度浮点型数据从大到小">CXW::CSVManage::STRING_Zz_TO_Aa</a>);
<a name="l00197"></a>00197         csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a1d7ee4d08ac1eaf47f8446325ebaf844" title="保存到文件">saveToFile</a> (<span class="stringliteral">&quot;./test/test_STRING_Zz_TO_Aa.csv&quot;</span>);
<a name="l00198"></a>00198 
<a name="l00199"></a>00199         csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a79af6dab96c74ffde913957ea1bba7f5" title="对内容按任意列的排序">sort</a> (1,<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a8bd8eeeb7e83173a7588479446dee976a8db0315ca6c69991a80495f20917799c" title="整型数据从小到大">CXW::CSVManage::INT_LITTLE_TO_LARGE</a>);
<a name="l00200"></a>00200         csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a1d7ee4d08ac1eaf47f8446325ebaf844" title="保存到文件">saveToFile</a> (<span class="stringliteral">&quot;./test/test_INT_LITTLE_TO_LARGE.csv&quot;</span>);
<a name="l00201"></a>00201 
<a name="l00202"></a>00202         csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a79af6dab96c74ffde913957ea1bba7f5" title="对内容按任意列的排序">sort</a> (1,<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a8bd8eeeb7e83173a7588479446dee976a5784cc8dbeab8dbaf27fcd548a2482c5" title="整型数据从大到小">CXW::CSVManage::INT_LARGE_TO_LITTLE</a>);
<a name="l00203"></a>00203         csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a1d7ee4d08ac1eaf47f8446325ebaf844" title="保存到文件">saveToFile</a> (<span class="stringliteral">&quot;./test/test_INT_LARGE_TO_LITTLE.csv&quot;</span>);
<a name="l00204"></a>00204 
<a name="l00205"></a>00205         csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a79af6dab96c74ffde913957ea1bba7f5" title="对内容按任意列的排序">sort</a> (1,<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a8bd8eeeb7e83173a7588479446dee976a3e534fb170aee58ad33158b1f2b8c2dd" title="单精度浮点型数据从小到大">CXW::CSVManage::FLOAT_LITTLE_TO_LARGE</a>);
<a name="l00206"></a>00206         csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a1d7ee4d08ac1eaf47f8446325ebaf844" title="保存到文件">saveToFile</a> (<span class="stringliteral">&quot;./test/test_FLOAT_LITTLE_TO_LARGE.csv&quot;</span>);
<a name="l00207"></a>00207 
<a name="l00208"></a>00208         csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a79af6dab96c74ffde913957ea1bba7f5" title="对内容按任意列的排序">sort</a> (1,<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a8bd8eeeb7e83173a7588479446dee976af5da77aee9474a8586076965e18391b3" title="单精度浮点型数据从大到小">CXW::CSVManage::FLOAT_LARGE_TO_LITTLE</a>);
<a name="l00209"></a>00209         csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a1d7ee4d08ac1eaf47f8446325ebaf844" title="保存到文件">saveToFile</a> (<span class="stringliteral">&quot;./test/test_FLOAT_LARGE_TO_LITTLE.csv&quot;</span>);
<a name="l00210"></a>00210 
<a name="l00211"></a>00211         csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a79af6dab96c74ffde913957ea1bba7f5" title="对内容按任意列的排序">sort</a> (1,<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a8bd8eeeb7e83173a7588479446dee976a5d1c3cf8f6e2bd44a6fb96e5a6c7717e" title="双精度浮点型数据从小到大">CXW::CSVManage::DOUBLE_LITTLE_TO_LARGE</a>);
<a name="l00212"></a>00212         csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a1d7ee4d08ac1eaf47f8446325ebaf844" title="保存到文件">saveToFile</a> (<span class="stringliteral">&quot;./test/test_DOUBLE_LITTLE_TO_LARGE.csv&quot;</span>);
<a name="l00213"></a>00213 
<a name="l00214"></a>00214         csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a79af6dab96c74ffde913957ea1bba7f5" title="对内容按任意列的排序">sort</a> (1,<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a8bd8eeeb7e83173a7588479446dee976a2070b303a3cca3d6bd73eb560b30b933" title="双精度浮点型数据从大到小">CXW::CSVManage::DOUBLE_LARGE_TO_LITTLE</a>);
<a name="l00215"></a>00215         csvMan.<a class="code" href="class_c_x_w_1_1_c_s_v_manage.html#a1d7ee4d08ac1eaf47f8446325ebaf844" title="保存到文件">saveToFile</a> (<span class="stringliteral">&quot;./test/test_DOUBLE_LARGE_TO_LITTLE.csv&quot;</span>);
<a name="l00216"></a>00216 }
</pre></div></div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Generated at 2012年七月13日 星期五 16:53:02 for CXW_CSVManage by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>

</body>
</html>
